#!/usr/bin/python
# -*- coding: utf-8 -*-
__author__ = 'ds'

#文件名称冲突
from email.mime.text import MIMEText
import smtplib
if __name__ == '__main__':
    msg = MIMEText(_text='SMTP test1111', _charset='utf-8')
    #输入Email地址和口令:
    from_addr = 'yunshilian@forke.cn'
    password = 'asdfasdf'
    # 输入SMTP服务器地址:
    smtp_server = 'smtp.ym.163.com'
    # 输入收件人地址:
    to_addr = 'simon4545@qq.com'

    #SMTP协议默认端口是25
    server = smtplib.SMTP(smtp_server, 25)
    server.set_debuglevel(1)
    # server.starttls()
    # server.connect(host=smtp_server, port=465)
    # server.esmtp_features["auth"]="AUTH_LOGIN"
    server.login(from_addr, password)
    server.sendmail(from_addr, [to_addr], msg.as_string())
    server.quit()